package com.black.app.domain.req.my.mydata;

import cn.hutool.core.util.StrUtil;
import com.black.common.core.domain.page.PageAbstructReq;
import com.black.common.utils.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * ClassName: AppMyMenstrualDetailAddReq
 * Package: com.black.app.domain.req.my.mydata
 * Description:
 *
 * @Author luo
 * @Create 2024/10/25 16:51
 * @Version 1.0
 */
@ApiModel(value = "AppMyMenstrualDetailAddReq", description = "添加我的月经记录请求参数")
@Data
@ToString(callSuper = true)
public class AppMyMenstrualDetailAddReq extends PageAbstructReq {

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id", hidden = true)
    private Long userId;

    /**
     * 月经周期
     */
    @ApiModelProperty(value = "月经第几期")
//    @NotNull(message = "月经第几期不能为空")
    private Integer menstrual;

    /**
     * 开始日期
     */
    @ApiModelProperty(value = "开始日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startdate;

    /**
     * 结束日期
     *默认值是开始时间后的第七天结束
     */
    @ApiModelProperty(value = "结束日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date enddate;

    /**
     * 类型（8种其一）
     * 默认值为”xi“
     */
    @ApiModelProperty(value = "类型（8种其一）", hidden = true)
    @NotNull(message = "类型不能为空")
    private String type = "jing";

    @ApiModelProperty(hidden = true)
    @Override
    public String getOrderBy() {
        if (StrUtil.isNotEmpty(super.getOrderByColumn())) {
            return super.getOrderByColumn() + " " + super.getIsAsc();
        }
        return null;
    }

}
